package com.scpii.universal.struts.rpc;

import javax.annotation.Resource;

import org.apache.struts2.json.annotations.SMDMethod;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.scpii.universal.action.BaseAction;
import com.scpii.universal.dto.UserInfoDto;
import com.scpii.universal.hibernate.entity.CatelogTab;
import com.scpii.universal.service.CatelogService;

@Controller
@Scope("prototype")
public class CateLogRPCAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8514331799425504002L;

	@Resource
	private CatelogService catelogService;

	@SMDMethod
	public boolean relation(Integer subCateId, String cateName,
			Integer parentCateId, Integer appId, Integer enterpId,
			Integer parentHasSubCate) {

		CatelogTab catelog = new CatelogTab();
		catelog.setIntParentCateId(parentCateId);
		catelog.setVarCateName(cateName);

		UserInfoDto userInfo = new UserInfoDto();
		userInfo.setAppId(appId);
		userInfo.setIntEnterpId(enterpId);
		catelogService.saveRelationsByCateId(catelog, subCateId,
				parentHasSubCate, userInfo);
		return true;
	}
}
